//1.一维树状数组模版题-单点修改 + 区间查询
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
ll a[N];
int n, q;
#define lowbit(x) (x & -x)

void modify(int x, int k)
{
    for(int i = x; i <= n; i += lowbit(i)) a[i] += k;
}

ll query(int x)
{
    ll sum = 0;
    for(int i = x; i; i -= lowbit(i)) sum += a[i];
    return sum;
}

int main()
{
    cin >> n >> q;
    for(int i = 1; i <= n; i++) 
    {
        int x; cin >> x;
        modify(i, x);
    }
    while(q--)
    {
        int op, x, y; cin >> op >> x >> y;
        if(op == 1)
        {
            modify(x, y);
        }
        else
        {
            cout << query(y) - query(x - 1) << endl;
        }
    }
    return 0;
}

